"""
locust的基本使用;
"""
from locust import HttpUser, task, between

from common.config.conf_sample1 import req_headers


# HttpUser 用来给每个用户提供一个client属性(HttpSession的实例)，向目标服务器发送HTTP请求
class QuickstartUser(HttpUser):
    """
    目标url：https://stock.xueqiu.com/v5/stock/hot_stock/list.json?size=8&_type=12&type=12
    """

    # 每个任务执行之后的等待时间
    wait_time = between(0.9, 1.2)

    # 标记用户将要执行的任务
    @task
    def task1(self):
        self.client.get("https://stock.xueqiu.com/v5/stock/hot_stock/list.json?size=8&_type=12&type=12",
                        headers=req_headers)


if __name__ == '__main__':
    pass
    # 启动: locust -f locustfiles/sample1.py
